<template>
	<view class="" style="display: inline-block;" v-if="this.hasLogin">
		<text class="cuIcon-appreciatefill text-red margin-lr-xs" v-if="if_vote" @click="message_vote({type:'agree',message:message})"></text> 
		<text class="cuIcon-appreciatefill  margin-lr-xs" @click="message_vote({type:'agree',message:message})" v-else></text> {{vote_count}}
	</view>

</template>

<script>
	import app from '@/mixins/app.js'
	import vote from '@/mixins/vote.js'
	export default {
		data(){
			return {
				
			}
		},
		mixins:[app,vote],
		props: {
			message: {
				type: [Object],
				default:()=>{
					return {}
				}
			},		
		},
		computed:{
			extra(){
				if(this.message.data&&this.message.data.extra){
					return this.message.data.extra
				}
				return {}
			},
			vote_extra(){
				if(this.extra&&this.extra.vote_extra){
					return this.extra.vote_extra
				}
				return {}
			},
			if_vote(){
				if(this.vote_extra&&this.vote_extra.vote_user_ids&&this.$tool.in_array(this.user.id,this.vote_extra.vote_user_ids)){
					return true
				}
				return false
			},
			vote_count(){
				if(this.vote_extra&&this.vote_extra.vote_user_ids){
					return this.vote_extra.vote_user_ids.length
				}
				return 0
			}
		}
	}
</script>

<style>
</style>
